import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_animation/HeroNew.dart';
import 'package:flutter_animation/HeroPage2.dart';

import 'main.dart';
import 'materialpage.dart';

class Routes {
  static Router router;
  static String rootPage = '/';
  static String material = '/material';
  static String heropage = '/heropage';
  static String hero = '/hero';
  static String heroNew = '/heroNew';

  static var roothHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return PageRoot();
  });
  static var materialHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return MaterialPage();
  });

  static var heroHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return HeroPage2();
  });

  static var heroNewHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    String tag = params['tag']?.first;
    return HeroNew(tag: tag);
  });

  static var heropageHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return HeroPage();
  });

  static void configureRoutes(Router router) {
    router.define(rootPage, handler: roothHandler);
    router.define(material, handler: materialHandler);
    router.define(hero, handler: heroHandler);
    router.define(heroNew, handler: heroNewHandler);
    router.define(material, handler: materialHandler);
    router.define(heropage, handler: heropageHandler);
    Routes.router = router;
  }
}
